Skip to content

feat: Warn or prevent scheduling interval faster than data timeframe (#396)#398

Merged
MDUYN merged 1 commit into
devfrom
feature/warn-scheduling-interval-faster-than-data-timeframe-396
Mar 19, 2026
Merged

feat: Warn or prevent scheduling interval faster than data timeframe (#396)#398
MDUYN merged 1 commit into
devfrom
feature/warn-scheduling-interval-faster-than-data-timeframe-396

Conversation

@MDUYN
Copy link
Copy Markdown
Collaborator

@MDUYN MDUYN commented Mar 19, 2026

Summary

Closes #396

Raises OperationalException during TradingStrategy.__init__ when the strategy's scheduling interval is faster than the smallest OHLCV data source timeframe.

Changes

  • investing_algorithm_framework/app/strategy.py — Added validation that computes the scheduling interval (time_unit.amount_of_minutes * interval) and compares it against the smallest OHLCV data source timeframe. Raises a descriptive OperationalException if the interval is too fast.

  • tests/app/test_strategy_interval_validation.py (new) — 7 test cases covering: raises on too-fast interval, accepts matching/slower intervals, validates against smallest OHLCV source, skips when no OHLCV sources, skips non-OHLCV sources, and checks the error message.

  • tests/app/test_data_completeness.py — Fixed test strategies that had invalid 1-minute intervals with 1-day OHLCV data (updated to DAY).

Example error message

OperationalException: Strategy 'MyStrategy' scheduling interval (1 minute = 1 min)
is faster than the smallest OHLCV data source timeframe (60 min). The strategy would
run without new data. Increase the scheduling interval or use a smaller data timeframe.

Tests

All 161 app tests pass (poetry run pytest tests/app/ -v).

…han data timeframe (#396)

- Add validation in TradingStrategy.__init__ that compares the strategy's
  scheduling interval (time_unit * interval) against the smallest OHLCV
  data source timeframe. Raises OperationalException with a descriptive
  message if the interval is too fast.
- Add 7 tests in tests/app/test_strategy_interval_validation.py covering
  all edge cases (faster, equal, slower, multiple sources, no sources,
  non-OHLCV sources, error message content).
- Fix test strategies in test_data_completeness.py that had invalid
  1-minute intervals with 1-day OHLCV data.
@MDUYN MDUYN merged commit cbfd597 into dev Mar 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant